package cn.gson.fengboot.model.pojos;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.Objects;

@Entity
public class Qproductdetail {
    private int prodetailId;
    private Qproduct productId;
    private BigDecimal gdId;
    private String prodetaiJpri;
    private String prodetailBh;
    private String  picturePath;
    private String productName;
    private BigDecimal prodetailSpri;
    private Integer prodetailKcnum;
    private Collection<Zbarterdetails> zbarterdetailsByProdetailId;
    private Collection<Zcontractdetails> zcontractdetailsByProdetailId;
    private Collection<Zdeliverydelivery> zdeliverydeliveriesByProdetailId;
    private Collection<Zdeliverylogdelivery> zdeliverylogdeliveriesByProdetailId;
    private Collection<Zorderdetails> zorderdetailsByProdetailId;
    private Collection<Qmodeldetails> qmodeldetails;
    private Collection<Qpicture> qpictures;
    private QtypeEntity typeId;
    @Basic
    @Column(name = "prodetail_bh")
    public String getProdetailBh() {
        return prodetailBh;
    }

    public void setProdetailBh(String prodetailBh) {
        this.prodetailBh = prodetailBh;
    }
    @Basic
    @Column(name = "picture_path")
    public String getPicturePath() {
        return picturePath;
    }

    public void setPicturePath(String picturePath) {
        this.picturePath = picturePath;
    }

    @ManyToOne
    @JoinColumn(name = "type_id", referencedColumnName = "type_id")
    public QtypeEntity getTypeId() {
        return typeId;
    }

    public void setTypeId(QtypeEntity typeId) {
        this.typeId = typeId;
    }

    @OneToMany(mappedBy = "prodetailId")
    public Collection<Qpicture> getQpictures() {
        return qpictures;
    }

    public void setQpictures(Collection<Qpicture> qpictures) {
        this.qpictures = qpictures;
    }

    @OneToMany(mappedBy = "prodetailId")
    public Collection<Qmodeldetails> getQmodeldetails() {
        return qmodeldetails;
    }

    public void setQmodeldetails(Collection<Qmodeldetails> qmodeldetails) {
        this.qmodeldetails = qmodeldetails;
    }


    @Id
    @Column(name = "prodetail_id")
    @GeneratedValue(strategy = GenerationType.IDENTITY,generator = "seq")
    public int getProdetailId() {
        return prodetailId;
    }

    public void setProdetailId(int prodetailId) {
        this.prodetailId = prodetailId;
    }


    @ManyToOne
    @JoinColumn(name = "product_id", referencedColumnName = "product_id")
    public Qproduct getProductId() {
        return productId;
    }

    public void setProductId(Qproduct productId) {
        this.productId = productId;
    }
    @Basic
    @Column(name = "gd_id")
    public BigDecimal getGdId() {
        return gdId;
    }

    public void setGdId(BigDecimal gdId) {
        this.gdId = gdId;
    }

    @Basic
    @Column(name = "prodetai_jpri")
    public String getProdetaiJpri() {
        return prodetaiJpri;
    }

    public void setProdetaiJpri(String prodetaiJpri) {
        this.prodetaiJpri = prodetaiJpri;
    }
    @Basic
    @Column(name = "product_name")
    public String getProductName() {
        return productName;
    }

    public void setProductName(String productName) {
        this.productName = productName;
    }


    @Basic
    @Column(name = "prodetail_spri")
    public BigDecimal getProdetailSpri() {
        return prodetailSpri;
    }

    public void setProdetailSpri(BigDecimal prodetailSpri) {
        this.prodetailSpri = prodetailSpri;
    }

    @Basic
    @Column(name = "prodetail_kcnum")
    public Integer getProdetailKcnum() {
        return prodetailKcnum;
    }

    public void setProdetailKcnum(Integer prodetailKcnum) {
        this.prodetailKcnum = prodetailKcnum;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Qproductdetail that = (Qproductdetail) o;
        return prodetailId == that.prodetailId &&
                Objects.equals(productId, that.productId) &&
                Objects.equals(gdId, that.gdId) &&
                Objects.equals(prodetaiJpri, that.prodetaiJpri) &&
                Objects.equals(prodetailSpri, that.prodetailSpri) &&
                Objects.equals(prodetailKcnum, that.prodetailKcnum);
    }

    @Override
    public int hashCode() {
        return Objects.hash(prodetailId, productId, gdId, prodetaiJpri, prodetailSpri, prodetailKcnum);
    }

    @OneToMany(mappedBy = "prodetailId")
    public Collection<Zbarterdetails> getZbarterdetailsByProdetailId() {
        return zbarterdetailsByProdetailId;
    }

    public void setZbarterdetailsByProdetailId(Collection<Zbarterdetails> zbarterdetailsByProdetailId) {
        this.zbarterdetailsByProdetailId = zbarterdetailsByProdetailId;
    }

    @OneToMany(mappedBy = "prodetailId")
    public Collection<Zcontractdetails> getZcontractdetailsByProdetailId() {
        return zcontractdetailsByProdetailId;
    }

    public void setZcontractdetailsByProdetailId(Collection<Zcontractdetails> zcontractdetailsByProdetailId) {
        this.zcontractdetailsByProdetailId = zcontractdetailsByProdetailId;
    }

    @OneToMany(mappedBy = "prodetailId")
    public Collection<Zdeliverydelivery> getZdeliverydeliveriesByProdetailId() {
        return zdeliverydeliveriesByProdetailId;
    }

    public void setZdeliverydeliveriesByProdetailId(Collection<Zdeliverydelivery> zdeliverydeliveriesByProdetailId) {
        this.zdeliverydeliveriesByProdetailId = zdeliverydeliveriesByProdetailId;
    }

    @OneToMany(mappedBy = "prodetailId")
    public Collection<Zdeliverylogdelivery> getZdeliverylogdeliveriesByProdetailId() {
        return zdeliverylogdeliveriesByProdetailId;
    }

    public void setZdeliverylogdeliveriesByProdetailId(Collection<Zdeliverylogdelivery> zdeliverylogdeliveriesByProdetailId) {
        this.zdeliverylogdeliveriesByProdetailId = zdeliverylogdeliveriesByProdetailId;
    }

    @OneToMany(mappedBy = "prodetailId")
    public Collection<Zorderdetails> getZorderdetailsByProdetailId() {
        return zorderdetailsByProdetailId;
    }

    public void setZorderdetailsByProdetailId(Collection<Zorderdetails> zorderdetailsByProdetailId) {
        this.zorderdetailsByProdetailId = zorderdetailsByProdetailId;
    }

    @Override
    public String toString() {
        return "Qproductdetail{" +
                "prodetailId=" + prodetailId +
                ", productId=" + productId +
                ", gdId=" + gdId +
                ", prodetaiJpri='" + prodetaiJpri + '\'' +
                ", prodetailSpri=" + prodetailSpri +
                ", prodetailKcnum=" + prodetailKcnum +
                ", zbarterdetailsByProdetailId=" + zbarterdetailsByProdetailId +
                ", zcontractdetailsByProdetailId=" + zcontractdetailsByProdetailId +
                ", zdeliverydeliveriesByProdetailId=" + zdeliverydeliveriesByProdetailId +
                ", zdeliverylogdeliveriesByProdetailId=" + zdeliverylogdeliveriesByProdetailId +
                ", zorderdetailsByProdetailId=" + zorderdetailsByProdetailId +
                ", qmodeldetails=" + qmodeldetails +
                ", qpictures=" + qpictures +
                '}';
    }
}
